<?php include './application/views/common/header.php'; ?>
<div class="w1000">
	<h2 style="margin-top:40px;font-size:24px;font-weight:bold;color:#c62721;">利息计算器</h2>
	<p>利息计算器,采用银行房贷等通用的"等额本息还款法",即借款者每月以相等的金额偿还贷款本息。 </p>
	<form action="/tools/index/" method="post">
		<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#e9e9e9"  style="margin-top:20px;" >
		  <tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">投标金额：</td>
			<td height="50" bgcolor="#FFFFFF" align="left"><input class="input" type="text" id="account" name="account" value="<?php echo isset($account)?$account:"";?>" class="toolsinput toolsinput2" />&nbsp;元</td>
		  </tr>
		  <tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">期限：</td>
			<td height="50" bgcolor="#FFFFFF" align="left">
			<input class="yzinput" type="text" name="times" id="times" value="<?php echo isset($times)?$times:"";?>" class="toolsinput toolsinput2" /> 
			<input type="radio" name="times_type" id="times_type" value="0" <?php if(@$times_type == 0){?>checked='checked'<?php }?> />个月&nbsp;
			<input type="radio" name="times_type" id="times_type" value="1" <?php if(@$times_type == 1){?>checked='checked'<?php }?> />天&nbsp;
			</td>
			<!-- 
			<td width="50" height="50" align="center" bgcolor="#FFFFFF"></td>
			 -->
		  </tr>
		  <tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">还款方式：</td>
			<td height="50" bgcolor="#FFFFFF" align="left">
			<select class="jeinput" id="repayment_type" name="repayment_type" class="toolsinput2">
				<option value="0" <?php if(@$repayment_type == 0){?>selected="selected"<?php }?>>等额本息</option>
				<option value="3" <?php if(@$repayment_type == 3){?>selected="selected"<?php }?>>到期还本,按月还息</option>
			</select>
			</td>
		  </tr>
		  <tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">年利率：</td>
			<td height="50" bgcolor="#FFFFFF" align="left"><input class="input" type="text" name="apr" id="apr" value="<?php echo isset($apr)?$apr:"";?>" class="toolsinput toolsinput2" />&nbsp;%&nbsp;</td>
		  </tr>
		  <tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">投标奖励：</td>
			<td height="50" bgcolor="#FFFFFF" align="left"><input class="input" type="text" name="reward" id="reward" value="<?php echo isset($reward)?$reward:"";?>" class="toolsinput toolsinput2"/>&nbsp;%&nbsp;</td>
		  </tr>
		  <tr>
			<td colspan="2"  height="50" colspan="4" align="center" bgcolor="#FFFFFF">
			  <input type="submit" name="button" id="button" value="提交" class="toolsbutton"/>
			</td>
			</tr>
		</table>
	</form>
	
		<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#e9e9e9" style="font-size:12px;">
			<?php if(@$repayment_type == 0){?>
				<tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">收益总计：</td>
			<td height="50" bgcolor="#FFFFFF" align="left">
			
				<?php if(@$times_type == 1){?>
				<?php echo number_format(@$account*(@$reward/100)+@$list[0]['repayment_account'],2); ?>
				<?php }else{?>
				<?php echo number_format(@$account*(@$reward/100)+@$result['repayment_account'],2);?>元
				<?php }?>
			&nbsp;</td>
		  </tr>
			<?php }?>
		  <tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">月化收益率：</td>
			<td height="50" bgcolor="#FFFFFF" align="left">
			<?php echo number_format(@$result['rmonth_apr'],2);?>%&nbsp;</td>
		  </tr>
		  <tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">年化收益率：</td>
			<td height="50" bgcolor="#FFFFFF" align="left"><?php echo number_format(@$result['rmonth_apr']*12,2);?>%&nbsp;</td>
		  </tr>
		  <tr>
			<td width="100" height="50" align="right" bgcolor="#FFFFFF">复利年化率：</td>
			<td height="50" bgcolor="#FFFFFF" align="left"><?php if(@$account>0){?><?php echo number_format(@round((round(@$account*pow((1+round(@$result['rmonth_apr']/100,6)),12),1)-@$account)/(@$account)*100, 2),2);?><?php }?>%&nbsp;</td>
		  </tr>
		  <tr>
			<td width="100%" height="50" align="center" bgcolor="#FFFFFF" colspan="2"><font color="red" style="font-size:12px;"> 声明：本站或本系统的内容可能存在误差，仅供参考，不可作为任何行为的依据。</font></td>
		  </tr>
		</table>
		
		<h3>偿还的时间表</h3>
		<table border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#e9e9e9" style="margin:50px;width:90%;">
		  <tr>
			<td height="30" align="center" bgcolor="#f4f4f4"><strong><?php if(@$times_type == 1){echo $times.'天'?><?php }else{?>月份<?php }?></strong></td>
			<td height="30" align="center" bgcolor="#f4f4f4"><strong><?php if(@$times_type == 1){echo $times.'天'?><?php }else{?>月<?php }?>偿还</strong></td>
			<td height="30" align="center" bgcolor="#f4f4f4"><strong><?php if(@$times_type == 1){echo $times.'天'?><?php }else{?>月<?php }?>本金还款</strong></td>
			<td height="30" align="center" bgcolor="#f4f4f4"><strong>利息</strong></td>
		  </tr>
		  <?php if(@$list){foreach($list as $key=>$value){?>
			<tr>
			<td height="30" align="center" bgcolor="#FFFFFF"><?php echo $key+1;?></td>
			<td height="30" align="center" bgcolor="#FFFFFF"><?php echo number_format($value['repayment_account'],2);?></td>
			<td height="30" align="center" bgcolor="#FFFFFF"><?php echo number_format($value['capital'],2);?></td>
			<td height="30" align="center" bgcolor="#FFFFFF"><?php echo number_format($value['interest'],2);?></td>
		  </tr>
			<?php }}?>
		</table>
</div>
<!-- Tools End -->
<?php include './application/views/common/footer.php'; ?>